package com.wzh.springboot.VO;

import lombok.Data;

/**
 * 描述：
 *
 * @author: wzh
 * @create: 2020-05-03 23:50
 **/
@Data
public class  ResultVO<T> {

    private int code = 0;
    private String msg = "";
    private T data;


    public static  ResultVO success = new  ResultVO();
    public static  ResultVO fail = new  ResultVO().code(-1);

    public static  ResultVO build() {
        return new  ResultVO();
    }

    public static <T>  ResultVO build(T data){
        return new  ResultVO().data(data);
    }

    public  ResultVO code(int code) {
        this.code = code;
        return this;
    }

    public  ResultVO data(T data) {
        this.data = data;
        return this;
    }

    public  ResultVO msg(String msg) {
        this.msg = msg;
        return this;
    }

}